/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2013, Christian Schudt
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

.number-spinner {
    -fx-skin: "extfx.scene.control.skin.NumberSpinnerSkin";
    -fx-padding: 0 0 0 0;
    -fx-cursor: default; /* Override the cursor since the "text" cursor is inherited from text field. But we want the default cursor over the buttons. */
}

/* A left directed arrow */
.number-spinner .arrow {
    -fx-padding: 3 3.5 3 3.5;
    -fx-shape: "M 100 100 L 300 100 L 200 300 z";
    -fx-background-color: #000000;
}


/* Make one-side rounded buttons */
.number-spinner .button.top-right {
    -fx-background-insets: 1 1 0 0, 1 1 0 0, 2 2 1 1, 3 3 2 2;
    -fx-background-radius: 0 3 0 0, 0 3 0 0, 0 2 0 0, 0 1 0 0;
}
.number-spinner .button.bottom-right {
    -fx-background-insets: 0 1 1 0, 0 1 1 0, 1 2 2 1, 2 3 3 2;
    -fx-background-radius: 0 0 3 0, 0 0 3 0, 0 0 1 0, 0 0 1 0;
}
.number-spinner .button.top-left {
    -fx-background-insets: 1 0 0 1, 1 0 0 1, 2 1 1 2, 3 2 2 3;
    -fx-background-radius: 3 0 0 0, 3 0 0 0, 2 0 0 0, 1 0 0 0;
}
.number-spinner .button.bottom-left {
    -fx-background-insets: 0 0 1 1, 0 0 1 1, 1 1 2 2, 2 2 3 3;
    -fx-background-radius: 0 0 0 3, 0 0 0 3, 0 0 0 2, 0 0 0 1;
}
.number-spinner .button.left {
    -fx-background-insets: 1 0 1 1, 1 0 1 1, 2 1 2 2, 3 2 3 3;
    -fx-background-radius: 3 0 0 3, 3 0 0 3, 2 0 0 2, 1 0 0 1;
}
.number-spinner .button.right {
    -fx-background-insets: 1 1 1 0, 1 1 1 0, 2 2 2 1, 3 3 3 2;
    -fx-background-radius: 0 3 3 0, 0 3 3 0, 0 2 2 0, 0 1 1 0;
}

/* Only make one side of the text field with round borders. */
.number-spinner .text-field.left {
    -fx-background-radius: 3 0 0 3, 2 0 0 2, 2 0 0 2;
}
.number-spinner .text-field.right {
    -fx-background-radius: 0 3 3 0, 0 2 2 0, 0 2 2 0;
}
/* Don't use round borders if the text field is in the center */
.number-spinner .text-field.center {
    -fx-background-radius: 0 0 0 0, 0 0 0 0, 0 0 0 0;
}

/* Make the focused text field look like an unfocused text field, since the whole spinner is already focused. */
.number-spinner .text-field:focused {
    -fx-background-color: -fx-shadow-highlight-color, -fx-text-box-border, -fx-control-inner-background;
}

/* Move the insets accordingly, so that there is still a little border visible between buttons and text field. */
.number-spinner .text-field.left:focused {
    -fx-background-insets: 2 0 2 2, 2 1 2 2, 2;
}
.number-spinner .text-field.right:focused {
    -fx-background-insets: 2 2 2 0, 2 2 2 1, 2;
}
.number-spinner .text-field.center:focused {
    -fx-background-insets: 2 0 2 0, 2 1 2 1, 2;
}

/* Apply the focus style to the whole control */
.number-spinner-focused {
    -fx-background-color: -fx-focus-color, -fx-text-box-border, -fx-control-inner-background;
    -fx-background-insets: -0.4, 1, 2;
    -fx-background-radius: 3.4, 2, 2;
}